#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.db.models import Sum
from rest_framework import serializers
from application.settings import redis_cli

from vehicle.models import Vehicle_info, Vehicle_move_info, Vehicle_fence, \
    Vehicle_fault_info, Vehicle_fault_log

from dvadmin.utils.serializers import CustomModelSerializer


class Vehicle_InfoModelSerializer(CustomModelSerializer):
    """
    车辆信息表序列化器
    """

    class Meta:
        model = Vehicle_info
        fields = "__all__"


class Vehicle_fenceModelSerializer(CustomModelSerializer):
    """
    电子围栏序列化器
    """

    class Meta:
        model = Vehicle_fence
        fields = "__all__"


class Vehicle_fault_infoModelSerializer(CustomModelSerializer):
    """
    故障表序列化器
    """

    class Meta:
        model = Vehicle_fault_info
        fields = "__all__"


class Vehicle_fault_logModelSerializer(CustomModelSerializer):
    """
    汽车故障日志序列化器
    """

    class Meta:
        model = Vehicle_fault_log
        fields = "__all__"


class Vehicle_move_infoModelSerializer(CustomModelSerializer):
    """
    车辆行驶记录序列化器
    """

    class Meta:
        model = Vehicle_move_info
        fields = ['vehicle_vin', 'start_time', 'end_time', 'score', 'offset']
